export default ({ env }) => ({
  // document插件
  documentation: {
    enabled: true,
    config: {
      openapi: '3.0.0',
      info: {
        version: '1.0.0',
        title: 'DOCUMENTATION',
        description: '',
        termsOfService: 'YOUR_TERMS_OF_SERVICE_URL',
        contact: {
          name: 'TEAM',
          email: 'contact-email@something.io',
          url: 'mywebsite.io'
        },
        license: {
          name: 'MIT',
          url: 'https://mit-license.org/'
        },
      },
      'x-strapi-config': {
        // Leave empty to ignore plugins during generation
        plugins: ['upload', 'users-permissions', 'comments'],
        path: '/documentation',
      },
      servers: [{ url: 'http://localhost:1337/api', description: 'Development server' }],
      externalDocs: {
        description: 'Find out more',
        url: 'https://strapi.nodejs.cn/developer-docs/latest/getting-started/introduction.html'
      },
      security: [{ bearerAuth: [] }]
    }
  },
  // nodemail插件
  email: {
    config: {
      provider: 'nodemailer', // For community providers pass the full package name (e.g. provider: 'strapi-provider-email-mandrill')
      providerOptions: {
        // QQ邮箱服务器和默认端口
        host: env('SMTP_HOST', 'smtp.qq.com'),
        port: env('SMTP_PORT', 465),
        auth: {
          // 发送账号和客户端鉴权码
          user: env('SMTP_USERNAME', '1802460004@qq.com'),
          pass: env('SENDGRID_API_KEY', 'rkisozipbimecbic'),
        },
      },
      settings: {
        defaultFrom: '1802460004@qq.com',
        defaultReplyTo: '1802460004@qq.com',
      },
    },
  },
  // comments插件
  // comments: {
  //   enabled: true,
  //   config: {
  //     badWords: false,
  //     // moderatorRoles: ["Authenticated"],
  //     // approvalFlow: ["api::page.page"],
  //     // entryLabel: {
  //     //   "*": ["Title", "title", "Name", "name", "Subject", "subject"],
  //     //   "api::page.page": ["MyField"],
  //     // },
  //     // blockedAuthorProps: ["name", "email"],
  //     // reportReasons: {
  //     //   MY_CUSTOM_REASON: "MY_CUSTOM_REASON",
  //     // },
  //     // gql: {
  //     //   // ...
  //     // },
  //   },
  // },
  // 用户认证模块
  'users-permissions': {
    config: {
      // 设置jwt两天过期
      jwt: {
        expiresIn: '2d',
      },
      // 设置注册时允许上传头像
      register: {
        allowedFields: ["avatar"],
      },
    },
  },
  // 日志插件
  logz: {
    enabled: true,
    config: {
      // skipList: ["car"],
    },
  }
});
